home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / IC++ 1.0b2 / ICTest.cpp < prev    next >
C/C++ Source or Header  |  1996-05-27  |  2KB  |  83 lines

  1. #include <stdio.h>
  2. #include "CInternetConfig.h"
  3.  
  4. void main()
  5. {
  6.     CInternetConfig theIC('IcTs');
  7.     ICError err;
  8.     Str255 emailAddress;
  9.     
  10.     // tell whether or not the component is installed
  11.     if (theIC.ICComponentInstalled())
  12.     {
  13.         printf("The component is installed\n");
  14.     }
  15.     else
  16.     {
  17.         printf("The component is not installed\n");
  18.     }
  19.     
  20.     err = theIC.Start();
  21.     if (err == noErr)
  22.     {
  23.         printf("Internet Config started\n");
  24.     }
  25.     else
  26.     {
  27.         printf("Internet Config could not be started because of error %ld\n", err);
  28.         return;
  29.     }
  30.     
  31.     // print the user's email address
  32.     err = theIC.GetEmailAddress(emailAddress);
  33.     if (err == noErr)
  34.     {
  35.         PtoCstr(emailAddress);
  36.         printf("Email address is %s\n", emailAddress);
  37.     }
  38.     else
  39.     {
  40.         printf("Could not get email address because of error %ld\n", err);
  41.     }
  42.     
  43.     // Do a URL
  44.     err = theIC.DoURL("\phttp://rhino.harvard.edu/dan/home.html");
  45.     if (err == noErr)
  46.     {
  47.         printf("DoURL successful\n");
  48.     }
  49.     else
  50.     {
  51.         printf("Could not do URL because of error %ld\n", err);
  52.     }
  53.     
  54.     // find the http helper
  55.     FSSpec httpSpec;
  56.     OSType httpCreator;
  57.     err = theIC.GetWebHelper(&httpSpec, &httpCreator);
  58.     if (err == noErr)
  59.     {
  60.         PtoCstr(httpSpec.name);
  61.         printf("Web helper found (%s)\n", httpSpec.name);
  62.         CtoPstr((char *)httpSpec.name);
  63.     }
  64.     else
  65.     {
  66.         printf("Could not locate web helper because of error %ld\n", err);
  67.     }
  68.     
  69.     // find the screen font
  70.     ICFontRecord screenFont;
  71.     err = theIC.GetScreenFont(&screenFont);
  72.     if (err == noErr)
  73.     {
  74.         PtoCstr(screenFont.font);
  75.         printf("Screen font = %s\n", screenFont.font);
  76.         CtoPstr((char *)screenFont.font);
  77.     }
  78.     else
  79.     {
  80.         printf("Could find screen font because of error %ld\n", err);
  81.     }
  82. }
  83.